package com.runtime.hongyunuser.mapper;

import com.runtime.hongyunuser.bean.Products;
import com.runtime.hongyunuser.bean.Userfavorites;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;
import com.runtime.hongyunuser.bean.Productimages;
import com.runtime.hongyunuser.bean.Products;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ProductMapper {
    //模糊查询
//    @Select("SELECT * FROM product WHERE productName LIKE CONCAT('%',#{productName},'%')")
    List<Products> selectProductByProductName(String keyword);
    //精确查询

    Products selectProductByProductNumber(String keyword);
    //模糊查询
    //获取收藏夹
    List<Userfavorites> selectProductFavorite(long uesrId);

    //添加收藏夹商品
    int addProductFavorite(long userId, long productId);

//删除收藏夹商品

    int deleteFavorite(@Param("userId") long userId, @Param("productId") long productId);


    //获取最新产品 创建时间前十个
    List<Products> getNewProducts();

    //获取推荐产品 随机七个
    List<Products> getFeaturedProducts();

    //获取价值产品 价值最低的十个
    List<Products> getValueProducts();

    //获取设备产品 随机七个
    List<Products> getDeviceProducts();

    //获取促销产品 促销产品随机七个
    List<Products> getPromotionProducts();

    //获取产品图片
    Productimages getProductImages(Integer productId);

    Products getProductById(long productId);

}
